package com.sky.kafkaDemo.service.impl;

import com.sky.kafkaDemo.entity.User;
import com.sky.kafkaDemo.entity.common.constant.MqConstant;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;

@Service
public class KafkaConsumerServiceImpl {

    @KafkaListener(topics = MqConstant.TOPIC_STRING, groupId = "my-group")
    public void consumeMessage(String message) {
        System.out.println("收到消息: " + message);
    }

    @KafkaListener(topics = MqConstant.TOPIC_USER, groupId = "my-group")
    public void consumeUser(User user) {
        System.out.println("收到用户信息: " + user.toString());
    }

}